<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/jsp/declare.jsp" %>

<!DOCTYPE html>
<html>
<head>
	<base href="<%=basePath %>" />
	<title>人员-列表</title>
	<%@ include file="/common/jsp/common.jsp" %>
	
	<script>
	function userAdd(renterId) {
		redirect("mvc/main/${communityId}/${roomId}/openGrantAdd.htm");
	}
	function userEdit(renterId) {
		redirect("mvc/main/${communityId}/${roomId}/" + renterId + "/openGrantUpd.htm");
	}
	function userDel(renterId) {
		jConfirm("确认删除？", function(yes){
			if (!yes)
				return;
			
			redirect("mvc/main/grantDel.htm?renterId=" + renterId + "&communityId=${communityId}&roomId=${roomId}");
		});
	}
	function houseList() {
		redirect("mvc/main/mainRoomList.htm");
	}
	</script>
</head>
<body id="room">
	<div class="address">地址：${address }</div>
	<table border="0" cellspacing="0" borderColor="#DADADA">
		<thead>
			<tr>
				<th>姓名</th>
				<th>房间</th>
				<th>截止日期</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="renter" items="${renterList}">
			<tr>
				<td>${renter.namel }</td>
				<td>${renter.room_num }</td>
				<td>${fn:substring(renter.end_date,0,10)}</td>
				<td>
					<button class="edit" onclick="userEdit('${renter.id }')">修改</button>
					<button class="delete" onclick="userDel('${renter.id }')">删除</button>
				</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="button-bar x2 center">
		<div class="button-bar center fixed bottom">
			<input type="button" value="新增人员" class="submit" onclick="userAdd()" />
			<input type="button" value="返回房屋" class="submit" onclick="houseList()" />
		</div>
	</div>
</body>
</html>